package weather;

import java.util.ArrayList;

public class Station implements IRequest {
	
	private String location;
	private ArrayList<IResponse> requesters;
	
	public Station(String location, IResponse requester) {
		this.location = location;
		this.requesters = new ArrayList<IResponse>();
		if (requester != null) {
			registerRequester(requester);
		}
	}
	
	public void measure() {
		Weather measurement = new Weather(this.location);
		for (IResponse requester: this.requesters) {
			requester.answer(measurement);
		}
	}
	
	public void registerRequester(IResponse requester) {
		requesters.add(requester);
	}
}